package com.itheima.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.itheima.pojo.Emp;
import com.itheima.pojo.EmpDto;
import com.itheima.pojo.EmpQueryParam;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;
import java.util.List;
import java.util.Map;

/**
 * @author: zhengsuyang
 * @Desc:
 * @create: 2025-09-05 19:51
 **/
@Mapper
public interface EmpMapper extends BaseMapper<Emp> {
/*    // 普通手动分页
    @Select("select count(*) from emp e join dept d on d.id = e.dept_id")
    long getTotal();
    @Select("select e.*,d.name as deptName from emp e join dept d on d.id = e.dept_id limit #{index},#{pageSize}")
    List<Emp> getEmpList(@Param("index") Integer index,@Param("pageSize") Integer pageSize);*/
    // pageHelper
//    @Select("select e.*,d.name as deptName from emp e join dept d on d.id = e.dept_id")
//    List<Emp> findAllEmpList();
//
//    List<Emp> conditionQueryEmpList(String name, Integer gender, Integer job, LocalDate begin, LocalDate end);
//
//    Integer delEmpById(Integer id);
//
//    Emp queryEmpById(Integer id);
//
//    List<Emp> conditionQueryEmpLists(EmpQueryParam empQueryParam);
//
//    void addEmp(Emp emp);
//
//    Integer delEmpByIds(List<Integer> ids);
//
//    void updateEmpById(Emp emp);

    @MapKey("jobName")
    List<Map<String,Object>> getEmpJobData();

    @MapKey("name")
    List<Map> getEmpGenderData();

    @MapKey("clazzName")
    List<Map<String, Object>> getStudentCountData();

    @MapKey("name")
    List<Map> getStudentDegreeData();


//    List<Emp> queryList();
    @Select("select  * from emp where username =#{username} and password = #{password} ")
    Emp finaEmpByPasswordAndUsername(EmpDto empDto);
}
